async function appendListJson(jsonUrl) {
  try {
    const response = await fetch(jsonUrl);
    if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
    
    const jsonData = await response.json();
    const container = document.getElementById('list-container');
    if (!container) return;

    // 获取或创建ul元素
    let ul = container.querySelector('ul');
    if (!ul) {
      ul = document.createElement('ul');
      container.appendChild(ul);
    }
	
	// 标题项
	jsonData.categories.forEach(item => {
		const li = document.createElement('li');
		li.className = 'title'
		li.innerHTML = `<i class="iconfont ${item.icon}"></i>`+item.name
		ul.appendChild(li);
		// 追加列表项
		item.items.forEach(item => {
		  const li = document.createElement('li');
		  li.innerHTML = `
		    <a rel="nofollow" href="${item.url}" target="_blank">
		      <i style="color: ${item.iconColor || '#00bcff'};"></i>
		      ${item.name}
		    </a>`;
		  ul.appendChild(li);
		});
	})
  } catch (error) {
    console.error('Error appending list:', error);
  }
}

appendListJson('./json/link.json')